package com.yjq.programmer.controller.admin;

import com.yjq.programmer.domain.AlbumCategory;
import com.yjq.programmer.dto.AlbumCategoryDTO;
import com.yjq.programmer.dto.AlbumDTO;
import com.yjq.programmer.dto.PageDTO;
import com.yjq.programmer.dto.ResponseDTO;
import com.yjq.programmer.service.IAlbumCategoryService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 杨杨吖
 * @QQ 823208782
 * @WX yjqi12345678
 * @create 2022-11-14 9:19
 */
@RestController("AdminAlbumCategoryController")
@RequestMapping("/admin/album/category")
public class AlbumCategoryController {

    @Resource
    private IAlbumCategoryService albumCategoryService;

    /**
     * 分页获取专辑分类数据
     * @param pageDTO
     * @return
     */
    @PostMapping("/list")
    public ResponseDTO<PageDTO<AlbumCategoryDTO>> getAlbumCategoryListByPage(@RequestBody PageDTO<AlbumCategoryDTO> pageDTO){
        return albumCategoryService.getAlbumCategoryListByPage(pageDTO);
    }

    /**
     * 保存专辑分类数据(添加、修改)
     * @param albumCategoryDTO
     * @return
     */
    @PostMapping("/save")
    public ResponseDTO<Boolean> saveAlbumCategory(@RequestBody AlbumCategoryDTO albumCategoryDTO){
        return albumCategoryService.saveAlbumCategory(albumCategoryDTO);
    }

    /**
     * 删除专辑分类数据
     * @param albumCategoryDTO
     * @return
     */
    @PostMapping("/remove")
    public ResponseDTO<Boolean> removeAlbumCategory(@RequestBody AlbumCategoryDTO albumCategoryDTO){
        return albumCategoryService.removeAlbumCategory(albumCategoryDTO);
    }

    /**
     * 获取全部专辑分类数据
     * @return
     */
    @PostMapping("/all")
    public ResponseDTO<List<AlbumCategoryDTO>> getAllAlbumCategory() {
        return albumCategoryService.getAllAlbumCategory();
    }
}
